import face_recognition

mayun_img = face_recognition.load_image_file("e:\\mayun.jpg")
leijun_img = face_recognition.load_image_file("e:\\leijun.jpg")
unknow_img = face_recognition.load_image_file("e:\\leijun2.jpg")

mayun_encoding = face_recognition.face_encodings(mayun_img)[0]
leijun_encoding = face_recognition.face_encodings(leijun_img)[0]
unknow_encoding = face_recognition.face_encodings(unknow_img)[0]

result = face_recognition.compare_faces([mayun_encoding, leijun_encoding], unknow_encoding)
labels = ["马云", "雷军"]

for i in range(0, len(result)):
    if result[i]:
        print("这个人是：" + labels[i])
